import request from '@/utils/request'

export const getImformationList = (params) => {
  return request({
    url: '/api/warehouse/page',
    params
  })
}

// 新增仓库页面开启回调
export const addImformation = () => {
  return request({
    url: '/api/codeFactory/next/CK'
  })
}

// 新增仓库
export const addWarehouse = (data) => {
  return request({
    url: '/api/warehouse',
    method: 'POST',
    data
  })
}

// 编辑仓库回显
export const aclearWarehouse = (id) => {
  return request({
    url: `/api/warehouse/${id}`,
    method: 'GET'
  })
}

// 修改仓库
export const clickWarehouseList = (data) => {
  return request({
    url: '/api/warehouse',
    method: 'PUT',
    data
  })
}

// 删除仓库
export const delWarehouse = (id) => {
  return request({
    url: `/api/warehouse?ids[]=${id}`,
    method: 'DELETE'
  })
}

// 库区管理

// 分页查询库区详细信息
export const getWarehouseList = (params) => {
  return request({
    url: 'api/area/pageDetail',
    params
  })
}

// 新增库区-编码回显
export const addFactory = () => {
  return request({
    url: '/api/codeFactory/next/KQ'
  })
}

// 查询全部库区
export const allFactory = (params) => {
  return request({
    url: '/api/area/list',
    params
  })
}

// 新增库区
export const addHouse = (data) => {
  return request({
    url: '/api/area',
    method: 'POST',
    data
  })
}

// 编辑库位的回显
export const aclearHouse = (id) => {
  return request({
    url: `/api/area/${id}`,
    method: 'GET'
  })
}

// 修改库区
export const clickHouse = (data) => {
  return request({
    url: '/api/area',
    method: 'PUT',
    data
  })
}

// 批量导入
export const uploadHouse = (data) => {
  return request({
    url: 'api/area/importExcel',
    method: 'POST',
    data
  })
}

// 删除库区
export const delHouse = (id) => {
  return request({
    url: `/api/area?ids[]=${id}`,
    method: 'DELETE'
  })
}
